Skip to content

feat(load2): add contract tests #4071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 22, 2025
Merged

feat(load2): add contract tests #4071

merged 13 commits into from
Jul 22, 2025

Conversation

RodrigoVillar
Copy link
Contributor

@RodrigoVillar RodrigoVillar commented Jul 10, 2025

Why this should be merged

This PR migrates over the existing contract tests from the original load framework into load 2.0. This PR also replaces the type of test used in load 2.0 testing (ZeroTransferTest => RandomTest).

How this works

Migration with the following caveats:

  • Rather than simple transfers having a high probability of being selected, each test has an equal probability of being chosen.
  • Previously, each individual test utilized a random parameter. Now, the parameters of an individual test are now the responsibility of the caller (i.e. parameter can be hard-coded or random).

How this was tested

CI

Need to be documented in RELEASES.md?

N/A

@RodrigoVillar RodrigoVillar self-assigned this Jul 10, 2025
@RodrigoVillar RodrigoVillar added the testing This primarily focuses on testing label Jul 10, 2025
Copy link
Contributor Author

@RodrigoVillar RodrigoVillar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting for context.

@RodrigoVillar RodrigoVillar requested a review from Elvis339 July 11, 2025 13:55
@RodrigoVillar RodrigoVillar marked this pull request as ready for review July 11, 2025 13:55
@RodrigoVillar RodrigoVillar requested a review from maru-ava as a code owner July 11, 2025 13:55
@RodrigoVillar RodrigoVillar requested a review from Copilot July 11, 2025 13:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates contract tests from the original load framework to load 2.0, replacing the simple ZeroTransferTest with a comprehensive RandomTest that can execute multiple test types with configurable weights.

  • Introduces a new RandomTest struct that uses weighted sampling to select from multiple test types
  • Adds 10 new contract test implementations (ReadTest, WriteTest, StateModificationTest, etc.)
  • Updates the main load generator to deploy a contract and use the new random test selection

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/load2/tests.go Adds RandomTest implementation and 10 contract test types with shared utility functions
tests/load2/main/main.go Updates main function to deploy contract and configure RandomTest with equal weights

@RodrigoVillar RodrigoVillar requested a review from maru-ava July 22, 2025 13:30
@maru-ava maru-ava added this pull request to the merge queue Jul 22, 2025
Merged via the queue into master with commit b169a9d Jul 22, 2025
29 checks passed
@maru-ava maru-ava deleted the load2-add-contract-tests branch July 22, 2025 14:35
@github-project-automation github-project-automation bot moved this to Done 🎉 in avalanchego Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Status: Done 🎉
Development

Successfully merging this pull request may close these issues.

3 participants